The J2XB library is designed to map Java Objects to XML data. The J2XB Axis2 Module maps method parameters and exceptions to XML, and as such suppports most of the capabilities of J2XB with some exceptions.
This section lists the support of a J2XB Axis2 Module for service creation - what J2XB annotations are supported and what types are supported.
The service class can accept annotations on a method or on the method parameters (Annotating the method is understood as annotating the return parameter of the method). The supported annotations are:
The MOWebParam annotation allows to control some aspects of the web method parameter, match line the MOProperty annotation for a Bean property. It allows to define, for a web method parameter, the following:
A Web Service using the J2XB module is itself scaned for those two annotations to register additional types with the J2XB system.
The MOSeeAlso annotation allows to register a number of beans with the J2XB system, mainly usefull when bean inheritence is used in the service (e.g. some service parameters are beans that can accept inherited beans as well).
The MORegisterPropertyEditor and MORegisterPropertyEditors annotations allows to register additional J2XB property editors - see the Types section.
The J2XB module allows to use any Java type as a method parameter (or a method return value) given that one of the following applies -
The J2XB Axis2 module supports exceptions and exception mapping to web services fault messages. Java built-in exceptions are automatically mapped while J2XB allows to map additional exception types.
The Throwable.message property is automatically mapped. The Throwable.stackTrace property can be mapped, if required. Note that mapping the stack trace can be considered a security risk and is disabled by default. To activate the stack trace mapping, use the J2XB_MAP_EXCEPTION_TRACE parameter in the services.xml file.
For instance, for the services.xml example in the introduction, we add
<service name="StockQuoteService" scope="application" targetNamespace="http://quickstart.samples/"> <description> Stock Quote Service </description> <module ref="J2XB"/> <schema schemaNamespace="http://quickstart.samples/xsd"/> <parameter name="ServiceClass">samples.quickstart.service.pojo.StockQuoteService</parameter> <parameter name="J2XB_MAP_EXCEPTION_TRACE">true</parameter> </service>